﻿using System;
using ScrappyDB.BaseClasses;
using NUnit.Framework;
namespace ScrappyDB.UnitTests
{
    
    
    /// <summary>
    ///This is a test class for ScrappyDbCollectionTest and is intended
    ///to contain all ScrappyDbCollectionTest Unit Tests
    ///</summary>
    [TestFixture()]
    public class ScrappyDbCollectionTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        public class TestEntity :SdbEntity
        {
            public Guid Id { get; set; }
        }


        [Test()]
        public void DirtyTest()
        {
            var target = new SdbCollection<TestEntity>(); 
            target.Add(new TestEntity() { Id = Guid.NewGuid() });
            target.Add(new TestEntity() { Id = Guid.NewGuid() });

            Assert.AreEqual(true, target.Dirty);

            target.Dirty = false;
            Assert.AreEqual(false, target.Dirty);

            target[0].Dirty = true;
            Assert.AreEqual(true, target.Dirty);
        }
    }

}
